set_project("code-judge")

set_version("0.0.1")

add_rules("mode.debug", "mode.release")

set_languages("c++20")

add_requires("pthread", "seccomp")

set_allowedplats("linux")

-- xmake.lua
set_toolset("cc", "g++-13")
set_toolset("cxx", "g++-13")
set_toolset("ld", "g++-13")

add_defines("ENABLE_DB_JUDGE")
add_requires("mysqlclient")

target("judge")
    set_kind("shared")
    add_files("src/judge.cpp")
    add_files("src/runcode.cpp")
    add_files("src/languages/*.cpp")
    add_files("src/judge_types/*.cpp")
    add_files("src/utility/*.cpp")

target("run_judge")
    set_kind("binary")
    add_files("src/run_judge.cpp")
    add_deps("judge")
    add_links("mysqlclient")
    add_links("judge", "pthread", "seccomp")
    add_linkorders("judge", "mysqlclient", "pthread", "seccomp")

target("run_test")
    set_kind("binary")
    add_files("src/run_test.cpp")
    add_deps("judge")
    add_links("mysqlclient")
    add_links("judge", "pthread", "seccomp")
    add_linkorders("judge", "mysqlclient", "pthread", "seccomp")